package com.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

// @WebListener
public class ListenerDemo1 implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("listener1执行了");
        ServletContext context = sce.getServletContext();
        String name = context.getInitParameter("name");
        System.out.println(name);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("listener1销毁了");
    }
}
